﻿using System.Data;
using System.Collections.Generic;
using CrazyTalk.Models;
namespace CrazyTalk.IDAL
{
    /// <summary>
    /// 接口层PermissionListBLL
    /// </summary>
    public interface IPermissionDAL
    {
        /// <summary>
        /// 根据输入的用户名和角色编号，获取用户的权限列表
        /// </summary>
        /// <param name="userId">用户名</param>
        /// <param name="roleId">角色编号</param>
        /// <returns></returns>
        DataTable GetPermissionList(string userId, int roleId);
        /// <summary>
        /// 得到最大ID
        /// </summary>
        int GetMaxId();
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        bool Exists(int RoleId, string MenuID, int FuncID);
        /// <summary>
        /// 增加一条数据
        /// </summary>
        bool Add(Permission model);
        /// <summary>
        /// 批量增加数据
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        int AddList(List<Permission> list);
        /// <summary>
        /// 更新一条数据
        /// </summary>
        bool Update(Permission model);
        /// <summary>
        /// 网吧连锁机构批量处理子角色的权限的方法
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        int UpdateList(List<Permission> list);
        /// 网吧连锁机构批量处理子角色的权限的方法
        //表PermissionList添加了字段PUserId后的修改
        int UpdateList2(List<Permission> list);
        /// <summary>
        /// 更新权限控制
        /// </summary>
        /// <param name="lsNewValue">新增权限值列</param>
        /// <param name="lsDelValue">删除权限值列</param>
        /// <param name="roleId">涉及角色编号</param>
        /// <returns></returns>
        bool UpdatePermission(List<string> lsNewValue, List<string> lsDelValue, int roleId);
        /// <summary>
        /// 更新权限控制(添加了PUserId的控制限制)
        /// </summary>
        /// <param name="lsNewValue">新增权限值列</param>
        /// <param name="lsDelValue">删除权限值列</param>
        /// <param name="roleId">涉及角色编号</param>
        /// <returns></returns>
        bool UpdatePermission2(List<string> lsNewValue, List<string> lsDelValue, int roleId);
        /// <summary>
        /// 删除一条数据
        /// </summary>
        bool Delete(int RoleId, string MenuID, int FuncID);
        /// <summary>
        /// 删除一条数据
        /// </summary>
        bool Delete(List<string> fields, List<object> values);
        /// <summary>
        /// 删除一条数据
        /// </summary>
        bool DeleteUnionMenu(List<string> fields, List<object> values);
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        Permission GetModel(int RoleId, string MenuID, int FuncID);
        /// <summary>
        /// 获得数据列表
        /// </summary>
        DataSet GetList(List<string> fields, List<object> values);
        //网吧连锁给下级设置权限提取权限时用。
        DataSet GetListUnionMenu1(List<string> fields, List<object> values);
        //网吧连锁给下级设置权限提取权限时用。(后期改进型，添加了PUserId字段)
        DataSet GetListUnionMenu2(List<string> fields, List<object> values);
        //主页快捷菜单专用
        DataSet GetListUnionMenu(List<string> fields, List<object> values, List<string> list);
        //主页快捷菜单专用（表permissionList添加了字段PUserId后的修改）
        DataSet GetListUnionMenu2(List<string> fields, List<object> values, List<string> list, string parentId);
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        DataSet GetList(int Top, List<string> fields, List<object> values, string filedOrder);
        int GetRecordCount(List<string> fields, List<object> values);
        DataSet GetListByPage(List<string> fields, List<object> values, string orderby, int startIndex, int endIndex);
    }
}
